const Router = require('koa-router')  //注意：引入的方式

const { auth } = require('../middleware/auth.middleware')
const { typeValidator, typeIdValidator, hasType, hasNotType} = require('../middleware/type.middleware')
const {search_type, add_type, edit_type, del_type } = require('../controller/type.controller')
const router = new Router({ prefix: '/type' })

// 查询
router.post('/typeInfo', auth, search_type)
// 新增
router.post('/add', auth, typeValidator, hasType, add_type)
// 修改
router.post('/edit', auth, typeIdValidator, edit_type)
// 删除
router.post('/del', auth, typeIdValidator, hasNotType, del_type);


module.exports = router